from django.db import models
from wxcloudrun.models import BaseModel

# Create your models here.


class FuliwuGame(BaseModel):
    # 0未上架 1上架
    state = models.IntegerField(default=0)
    name = models.CharField(max_length=100, verbose_name="游戏名称")
    cover_url = models.CharField(max_length=255, verbose_name="封面url")
    start_time = models.DateTimeField(null=True, verbose_name="消费开始时间")
    end_time = models.DateTimeField(null=True, verbose_name="消费结束时间")
    consumption_amount = models.PositiveIntegerField(verbose_name="满足消费金额")
    explain = models.UUIDField(null=True, verbose_name="说明uuid")
    open_time = models.DateTimeField(null=True, verbose_name="开奖时间")
    draw = models.IntegerField(default=0, verbose_name="开奖状态")

    class Meta:
        db_table = "FuliwuGame"
        indexes = [
            models.Index(fields=["uuid"]),
            models.Index(fields=["deleted"]),
            models.Index(fields=["name"]),
            models.Index(fields=["state"]),
        ]


class FuliwuGood(BaseModel):
    game_uuid = models.UUIDField(verbose_name="池子uuid")
    good_uuid = models.UUIDField(verbose_name="赏品uuid")
    level_uuid = models.UUIDField(null=True, verbose_name="赏品等级uuid")
    count = models.IntegerField(default=0,verbose_name="赏品数量")
    rf_count = models.IntegerField(default=0, verbose_name="剩余数量")
    price = models.IntegerField(default=0,verbose_name='赏品价值')

    class Meta:
        db_table = "FuliwuGood"
        indexes = [
            models.Index(fields=["uuid"]),
            models.Index(fields=["deleted"]),
            models.Index(fields=["game_uuid"]),
            models.Index(fields=["good_uuid"]),
        ]


class FuliwuRecoder(BaseModel):
    game_uuid = models.UUIDField()
    user_uuid = models.UUIDField(null=True)
    good_uuid = models.UUIDField(null=True)
    state = models.IntegerField(default=0, verbose_name="中奖状态")

    class Meta:
        db_table = "FuliwuRecoder"
        indexes = [
            models.Index(fields=["uuid"]),
            models.Index(fields=["deleted"]),
            models.Index(fields=["good_uuid"]),
            models.Index(fields=["game_uuid"]),
            models.Index(fields=["user_uuid"]),
        ]


class FuliEnroll(BaseModel):
    game_uuid = models.UUIDField()
    user_uuid = models.UUIDField(null=True)
    state = models.IntegerField(default=0,verbose_name='绑定状态')
    class Meta:
        db_table = "FuliEnroll"
        indexes = [
            models.Index(fields=["uuid"]),
            models.Index(fields=["deleted"]),
            models.Index(fields=["game_uuid"]),
            models.Index(fields=["user_uuid"]),
        ]